package com.itwn.comic.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itwn.comic.mapper.BuyMapper;
import com.itwn.comic.vo.BuyDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Repository
public class BuyService {

    @Autowired
    BuyMapper buyMapper ;

    public PageInfo<BuyDetailVo> queryDetailByPages(Integer now, Integer size, String username, String resourcename) {
        PageHelper.startPage(now , size) ;

        List<BuyDetailVo> list = buyMapper.selectBuyDetailByCons(username , resourcename) ;

        return new PageInfo<>(list) ;
    }

    public void removeByKey(Integer userId , Integer sectionId) {

        this.buyMapper.deleteByKey(userId , sectionId) ;
    }
}
